// pages/account-detail/index.js
import config from '../../etc/config'

const {
  $Toast
} = require('../../components/dist/base/index');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    key: '',
    current:'2',
    drawListByde:[{
      drawTime:'',
      drawRemitTime:'',
      drawMoney:'',
    }],
    currentPage: 1
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    wx.hideShareMenu()
    this.setData({
      deId: options.deId
    })
    this.getdrawListByde(2)
  },
  getdrawListByde(key) {
    let params = {
      deId:this.data.deId,
      status:key
    }
    let token = wx.getStorageSync('token')
    config._post('/deliverymandraw/drawListByde', token, params).then(res => {
      this.setData({
        drawListByde : res.data.records,
        currentPage: res.data.currPage + 1
      })
      wx.stopPullDownRefresh()
    })
  },
  handleChange(e){
    this.setData({
      current: e.detail.key
    })
    this.getdrawListByde(e.detail.key)
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    this.getdrawListByde(this.data.current)
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {
    this.setData({
      currentPage: 1
    })
    this.getdrawListByde(this.data.current)
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})